/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ats.org.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ghanem
 */
@Entity
@Table(name = "GEN_COUNTRIES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GenCountry.findAll", query = "SELECT g FROM GenCountry g"),
    @NamedQuery(name = "GenCountry.findByCountryNo", query = "SELECT g FROM GenCountry g WHERE g.countryNo = :countryNo")})
public class GenCountry implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "COUNTRY_NO")
    private Short countryNo;
    @Size(max = 60)
    @Column(name = "COUNTRY_NAME")
    private String countryName;
    @Size(max = 60)
    @Column(name = "COUNTRY_NAME_S")
    private String countryNameS;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "NATIONALITY")
    private String nationality;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "NATIONALITY_S")
    private String nationalityS;
    @Size(max = 6)
    @Column(name = "COUNTRY_KEY")
    private String countryKey;
    @Size(max = 5)
    @Column(name = "SHORTCUT")
    private String shortcut;
    @Column(name = "IS_HOME_LAND")
    private Short isHomeLand;
    @Size(max = 3)
    @Column(name = "ISO_CODE")
    private String isoCode;
    @Column(name = "MOHE_COUNTRY_CODE")
    private Short moheCountryCode;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "genCountries")
    private Collection<GenCity> genCityCollection;

    public GenCountry() {
    }

    public GenCountry(Short countryNo) {
        this.countryNo = countryNo;
    }

    public GenCountry(Short countryNo, String nationality, String nationalityS) {
        this.countryNo = countryNo;
        this.nationality = nationality;
        this.nationalityS = nationalityS;
    }

    public Short getCountryNo() {
        return countryNo;
    }

    public void setCountryNo(Short countryNo) {
        this.countryNo = countryNo;
    }

    public String getCountryName() {
        return countryName;
    }

    public void setCountryName(String countryName) {
        this.countryName = countryName;
    }

    public String getCountryNameS() {
        return countryNameS;
    }

    public void setCountryNameS(String countryNameS) {
        this.countryNameS = countryNameS;
    }

    public String getNationality() {
        return nationality;
    }

    public void setNationality(String nationality) {
        this.nationality = nationality;
    }

    public String getNationalityS() {
        return nationalityS;
    }

    public void setNationalityS(String nationalityS) {
        this.nationalityS = nationalityS;
    }

    public String getCountryKey() {
        return countryKey;
    }

    public void setCountryKey(String countryKey) {
        this.countryKey = countryKey;
    }

    public String getShortcut() {
        return shortcut;
    }

    public void setShortcut(String shortcut) {
        this.shortcut = shortcut;
    }

    public Short getIsHomeLand() {
        return isHomeLand;
    }

    public void setIsHomeLand(Short isHomeLand) {
        this.isHomeLand = isHomeLand;
    }

    public String getIsoCode() {
        return isoCode;
    }

    public void setIsoCode(String isoCode) {
        this.isoCode = isoCode;
    }

    public Short getMoheCountryCode() {
        return moheCountryCode;
    }

    public void setMoheCountryCode(Short moheCountryCode) {
        this.moheCountryCode = moheCountryCode;
    }

    @XmlTransient
    public Collection<GenCity> getGenCityCollection() {
        return genCityCollection;
    }

    public void setGenCityCollection(Collection<GenCity> genCityCollection) {
        this.genCityCollection = genCityCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (countryNo != null ? countryNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GenCountry)) {
            return false;
        }
        GenCountry other = (GenCountry) object;
        if ((this.countryNo == null && other.countryNo != null) || (this.countryNo != null && !this.countryNo.equals(other.countryNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ats.edugate.model.entities.GenCountries[ countryNo=" + countryNo + " ]";
    }
    
}
